//
//
//
#include "card_list.h"


//
//
#include "douservice/dou_card.h"
#include <stdio.h>
#include <stdlib.h>


/*
 * struct dou_list
 */
struct card_list {

    dcard card;
    clist next;

};



//
//
//
clist
clist_create()
{
    clist cl;
    cl = (clist)malloc( sizeof(struct card_list) );
    if ( cl == NULL )
        return NULL;

    // null header
    cl->card = NULL;
    cl->next = NULL;
}

//
//
//
void
clist_delete( clist cl )
{
    clist ctmp = NULL;
    clist cnext = NULL;

    if ( cl == NULL )
        return;
    ctmp = cl->next;

    // delete header
    free( cl );

    if ( ctmp == NULL )
	return;

    do {
        cnext = ctmp->next;
	dcard_delete( ctmp->card );
	free( ctmp );
	ctmp = NULL;
    } while ( (ctmp = cnext) != NULL );
}

//
//
//
int
clist_append( clist cl, dcard dd )
{
    clist cend = NULL;
    


}


//
//
//
clist
clist_end( clist cl )
{
    clist ctmp = cl;
    clist cnext = NULL;

    while ( (cnext=ctmp->next) != NULL ) {
        ctmp = cnext;
    }
    return ctmp;
}
